package {

	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	import flash.text.TextField;

	public class AS3AnimationAdvanced extends Sprite {
		public function AS3AnimationAdvanced(){
			if (stage){
				init();
			} else {
				this.addEventListener(Event.ADDED_TO_STAGE, init);
			}

		}
		z
		private function init(event:Event = null):void {
			var bmd1:BitmapData = new BitmapData(80, 80, true, 0x00FF0000);
			var rect:Rectangle = new Rectangle(20, 20, 40, 40);
			bmd1.fillRect(rect, 0xFF0000FF);
			var bm:Bitmap = new Bitmap(bmd1);
			this.addChild(bm);
			var tf:TextField = new TextField();
			trace("tf:", tf.width, tf.height);
			tf.text = "1311111111111111111111111111111112";
			this.addChild(tf);
			trace("tf:", tf.width, tf.height);
			var pt1:Point = new Point(1, 1);
			trace(bmd1.hitTest(pt1, 0x00, pt1)); // false
			var pt2:Point = new Point(40, 40);
			trace(bmd1.hitTest(pt1, 0xFF, pt2)); // true
		}
	}
}